import Cookies from 'js-cookie'

const app = {
  state: {
    sidebar: {
      opened: !+Cookies.get("sidebarStatus"),
      withoutAnimation: false
    },
    listReq: {
      $size: 30,
      $page: 1
    },
    pageSizeArr: [10, 30, 100, 200, 500, 1000],
    ReChargeStatus: {
      1: "待审核",
      2: "拒绝",
      3: "审核通过",
      4: "已追分"
    },
    MchType: {
      1: "内部商户",
      2: "外部商户"
    },
    PayMethodType: {
      1: "支付宝个人账户",
      2: "支付宝个人吱口令",
      3: "支付宝个人二维码",
      4: "支付宝个人收款码",
      5: "支付宝个人转银行卡",
      6: "支付宝花呗",
      7: "支付宝信用卡",
      8: "微信个人收款码",
      9: "微信个人转银行卡",
      10: "微信信用卡",
      11: "银行卡支付"
    },
    RecepiptMethodType: {
      1: "支付宝",
      2: "支付商家",
      3: "微信",
      4: "微信商家",
      5: "银行卡"
    },
    payType: {
      1: "支付宝",
      2: "微信",
      3: "花呗",
      4: "信用卡",
      5: "银行卡"
    },
    userType: {
      new_user: '新用户',
      next_day: '次日用户',
      week_user: '周用户',
      veteran_user: '老用户'
    },
    AgentLevel: {
      1: "1级",
      2: "2级",
      3: "3级"
    },
    RecepiptType: [
      {
        id: 1, //支付宝/微信/银联/花呗/信用卡
        name: "支付宝",
        children: [
          {
            id: 1,
            name: "个人支付宝",
            accountName: "支付宝账号"
          },
          {
            id: 2,
            name: "商户支付宝"
          }
        ]
      },
      {
        id: 2,
        name: "微信",
        children: [
          {
            id: 3,
            name: "个人微信",
            accountName: "微信账号"
          },
          {
            id: 4,
            name: "商户微信"
          }
        ]
      },
      {
        id: 3,
        name: "银行卡",
        children: [
          {
            id: 5,
            name: "个人银行卡"
          }
        ]
      }
    ],
    qiniuUrl: "http://image.barchain.net/",
    BankCode: {
      ICBC: '工商银行',
      CCB: '建设银行',
      BOC: '中国银行',
      ABC: '农业银行',
      BCM: '交通银行',
      CMB: '招商银行',
      PSBC: '邮政银行',
      CNCB: '中信银行',
      CEB: '光大银行',
      HXB: '华夏银行',
      SPDB: '浦发银行',
      CIB: '兴业银行',
      CMBC: '民生银行',
      PAB: '平安银行',
      CGB: '广发银行',
      HRBB: '哈尔滨银行',
      CZB: '浙商银行',
      QDCCB: '青岛银行',
      CSCB: '长沙银行',
      NJCB: '南京银行',
      RCB: '农村商业银行',
      OTHERS: '其它银行'
    },
    showServiceIframe: false,
    orderStatus: {
      1: "未充值",
      2: "提交第三方",
      3: "充值成功",
      4: "充值失败",
      5: "已取消（手动取消）",
      6: "超时过期",
      7: "追分成功",
      8: "待审核",
      9: "审核失败",
      10: "充值成功"
    },
    UserLevel: {
      0: "免费用户",
      1: "普通用户",
      2: "中级用户",
      3: "高级用户"
    },
    orderType: {
      1: "手动充值",
      2: "自动充值",
      3: "自动充值"
    }
  },
  mutations: {
    TOGGLE_SIDEBAR: state => {
      if (state.sidebar.opened) {
        Cookies.set("sidebarStatus", 1);
      } else {
        Cookies.set("sidebarStatus", 0);
      }
      state.sidebar.opened = !state.sidebar.opened;
    },
    CHANGE_SHOWSERVICEIFRAME: state => {
      this.state.showServiceIframe = !this.state.showServiceIframe;
    }
  },
  actions: {
    ToggleSideBar: ({ commit }) => {
      commit("TOGGLE_SIDEBAR");
    },
    CHANGE_SHOWSERVICEIFRAME: ({ commit }) => {
      commit("CHANGE_SHOWSERVICEIFRAME");
    }
  }
};

export default app
